package com.icinfo.cloud.provider.punish.common.nonlitigation.enums;

import com.icinfo.cloud.provider.common.constant.Constant;
import org.springframework.util.ObjectUtils;

/**
 * 描述：非诉执行材料类型枚举
 *
 * @author shishengyao
 * @description
 * @date 2022/4/8
 */
public enum NonLitigationApplicationMaterialEnum {
    QZZXSQS("1", "强制执行申请书", "QZZXSQS"),
    XZCFJDS("2", "行政处罚决定书", Constant.STRING_KIND_CODE_CFJDS),
    XZJDLXCGS("3", "行政决定履行催告书", "XZJDLXCGS"),
    SSCYRZTZGCL("4", "诉讼参与人主体资格材料", ""),
    ZJCL("5", "证据材料", "EVIDENCE"),
    CFGZS("6", "处罚告知书", "EVIDENCE");
    /**
     * 代码
     */
    private String code;
    /**
     * des
     */
    private String des;
    /**
     * relCode
     */
    private String relCode;

    NonLitigationApplicationMaterialEnum(String code, String des, String relCode) {
        this.code = code;
        this.des = des;
        this.relCode = relCode;
    }

    /**
     * 描述：根据relCode获取code
     *
     * @param relCode rel代码
     * @return {@link String }
     * @author shishengyao
     * @date 2022/04/09
     */
    public static String getCodeByRelCode(String relCode) {
        if (ObjectUtils.isEmpty(relCode)) {
            return null;
        }
        if ("BUSINESS_LICENCE_CERT".equals(relCode) || "USER_CARD".equals(relCode)) {
            return NonLitigationApplicationMaterialEnum.SSCYRZTZGCL.getCode();
        } else {
            for (NonLitigationApplicationMaterialEnum e : NonLitigationApplicationMaterialEnum.values()) {
                if (relCode.equals(e.getRelCode())) {
                    return e.getCode();
                }
            }
        }
        return relCode;
    }

    /**
     * 描述：根据relCode获取code
     *
     * @param relCode rel代码
     * @return {@link String }
     * @author shishengyao
     * @date 2022/04/09
     */
    public static String getDesByRelCode(String relCode) {
        if (ObjectUtils.isEmpty(relCode)) {
            return null;
        }
        if ("BUSINESS_LICENCE_CERT".equals(relCode) || "USER_CARD".equals(relCode)) {
            return NonLitigationApplicationMaterialEnum.SSCYRZTZGCL.getDes();
        } else {
            for (NonLitigationApplicationMaterialEnum e : NonLitigationApplicationMaterialEnum.values()) {
                if (relCode.equals(e.getRelCode())) {
                    return e.getDes();
                }
            }
        }
        return relCode;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    public String getRelCode() {
        return relCode;
    }

    public void setRelCode(String relCode) {
        this.relCode = relCode;
    }
}
